package dm_pm;

/**
 * This class represents a "recipe" for a periodic task.
 * 
 * @author Tom Deering
 * @author Dossay Oryspayev
 * 
 */
public class Task {
	private static long idCount;
	/**The identifier for this task*/
	private long id;

	/**Computation time of the task in units of ticks*/
	private long computationTime;
	/**Period of the task in units of ticks*/
	private long period;
	/**Relative deadline of the task in units of ticks*/
	private long deadline;
	/**The absolute time when the next instance of the task will arrive*/
	private long nextInstance;
	
	public Task(long computationTime, long period, long deadline){
		setId(idCount++);
		this.computationTime = computationTime;
		this.period = period;
		this.deadline = deadline;
		this.nextInstance = 0;
	}
	
	public long getId() {
		return this.id;
	}
	
	private void setId(long id) {
		this.id = id;
	}


	public long getComputationTime() {
		return computationTime;
	}

	public void setComputationTime(long computationTime) {
		this.computationTime = computationTime;
	}

	public long getPeriod() {
		return period;
	}

	public void setPeriod(long period) {
		this.period = period;
	}

	public long getDeadline() {
		return deadline;
	}

	public void setDeadline(long deadline) {
		this.deadline = deadline;
	}

	public long getNextInstance() {
		return nextInstance;
	}

	public void setNextInstance(long nextInstance) {
		this.nextInstance = nextInstance;
	}
	
	
		
	public String toString() {
		return "Task = [id: "+this.id+"; "+
	           "comp. time: "+getComputationTime()+";\n"+
	           "deadline: "+getDeadline()+"; "+
			   "period: " + getPeriod() + "]";
	}

	
}
